package com.teachoa.enumtype;

public enum UserTypeEnum {
	
	ADMIN(0, "管理", "1,8,3,5,2,12,13"),
	TEACHER(1, "教师", "1,9,4,6,7,14"),
	STUDENT(2, "学生", "1,10,11,7"),
	EXPERT(3, "专家", "1,4,7");
	
	private int code;
	private String desc;
	private String menus;
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
	public String getMenus() {
		return menus;
	}
	public void setMenus(String menus) {
		this.menus = menus;
	}
	private UserTypeEnum(int code, String desc, String menus) {
		this.code = code;
		this.desc = desc;
		this.menus = menus;
	}

	public static UserTypeEnum getEnumByCode(int code) {
		UserTypeEnum[] enums = UserTypeEnum.values();
		for(UserTypeEnum enumtype:enums) {
			if(enumtype.getCode()==code) {
				return enumtype;
			}
		}
		return null;
	}

}
